link: markdown content

---- start of layout ----

Note Layout Title

Single page application

Since this is a SPA (Single page application), index.html is the main starting point where everything comes together. The entire app’s code is organised in the src/ directory but after user requsts the page, everything is rendered inside a single .html file. Everything at once. This HTML file contains a placeholder or “root” element that react uses as the mounting point, usually simple <div id="root"></div>. React dynamically injects and manages the app’s components using JavaScript, creating a seamless user experience without the need to reload the entire page. This means that initial loading time is a bit longer.

Entire javascript bundle must be downloaded, parsed and executed before the app becomes interactive. However, there are several strategies to optimise the initial loading time. Code splitting, lazy loading, tree shaking (minimise the size of the javascript bundle by including only the code that is actually used), server-side rendering (SSR, render the initial html on the server and send it to the cient, allow users to see the content faster while in the background javascript loads and hydrates the app as needed)… There are many more optimisation strategies but the point is that single page applications (SPA) needs a bit more time after initial request and later the user experience is smooth and seamless even when user browse through different pages. There is no need to reload or refresh since everything is already loaded. Browsing through different pages is handled by the React-router.

What happens after initial request by the user?

The process common for most single page applications allows the React app to provide fast user experience by handling routing and content updates entirely on the client side.

Each moment is a unique, fleeting opportunity.

---- End of layout ----